function [hfig,hax,hrect] = maingridfn(m,n,scrambled,fontsize,sqsize)
%This file generates the keyboard of m x n letters and returns handles for
%the objects
%Option to scramble the keyboard and fontsize are the other parameters
%%

%Draw squares
hfig = figure('Name','Virtual Keyboard','MenuBar','none',...
    'resize','off','BackingStore','off','position',get(0,'ScreenSize'),...
    'NumberTitle','off','Pointer','custom','PointerShapeCData',repmat(NaN,[16 16]),'CloseRequestFcn',@closekeyboard);
   


xlim = [-0.2 5+0.2];
ylim = [-0.2 5+0.2];

global sqedge

hax=axes;
set(hax,'Position',[0.01 0.025 0.95 0.95]);
axis([xlim ylim]);
axis equal;axis manual;
set(hax,'xtick',[]);set(hax,'ytick',[]);axis off;

%Draw m x n unit squares
for j=1:n,
    for i=1:m, 
        position=[(i-1)*sqedge (j-1)*sqedge sqedge sqedge];
        hrect(i,j)=rectangle('Position',position);
        set(hrect(i,j),'LineWidth',2,'FaceColor',[1 1 1]);
    end
end




